import java.util.Comparator;
import java.util.Objects;
import java.util.PriorityQueue;

// 扑克牌
class Card {
    public int point;// 点数
    public String suit;// 花色
    public Card(int point,String suit){
        this.point = point;
        this.suit = suit;
    }
    // 重写 toString 方法
    @Override
    public String toString() {
        return "Card{" +
                "point=" + point +
                ", suit='" + suit + '\'' +
                '}';
    }

//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        Card card = (Card) o;
//        return point == card.point && Objects.equals(suit, card.suit);
//    }
//
//    @Override
//    public int hashCode() {
//        return Objects.hash(point, suit);
//    }
}


//class PointComparator implements Comparator<Card> {
//    @Override
//    public int compare(Card o1, Card o2) {
//        return o1.point - o2.point;
//    }
//}

public class TestDemo {
    public static void main(String[] args) {
        // 默认是 小根堆
//        PointComparator pointComparator = new PointComparator();
//        PriorityQueue<Card> priorityQueue = new PriorityQueue<>(new Comparator<Card>() {
//            @Override
//            public int compare(Card o1, Card o2) {
//                return o1.point - o2.point;
//            }
//        });
        PriorityQueue<Card> priorityQueue = new PriorityQueue<>((x,y) -> {return x.point - y.point;} );
        Card card1 = new Card(2,"♥");
        Card card2 = new Card(1,"♥");
//        System.out.println(card1.equals(card2));
        priorityQueue.offer(card1);
        priorityQueue.offer(card2);
        System.out.println(priorityQueue);

    }
}
